<?php
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL || ~E_NOTICE);
	$sqlserver  = '192.168.1.10'; 
    $sqldatabase= 'GT';
    $sqluser    = 'sa2';
    $sqlpassword= 'sasa';
    $sqlconnection = odbc_connect("Driver={SQL Server};Server=$sqlserver;Database=$sqldatabase;", $sqluser, $sqlpassword);
    
    $orderId = $_POST['orderId'];
    $docEntryId = $_POST['docentryId'];
    $lineId = $_POST['lineId'];
    
    $checkSql = "SELECT * from [Import_Z0090]  WHERE DocEntry='{$docEntryId}' AND orderid='{$orderId}' AND Lineid='{$lineId}'";
    $ckres=odbc_exec($sqlconnection,$checkSql); 
    if(odbc_fetch_row($ckres)){
        exit('发货处理中,请勿重复操作');
    };

      
    
    $saveSql = "insert into [Import_Z0090](DocEntry,Lineid,OrderId,Phone,ExpNo,ExpCom,Weight) values ('{$docEntryId}','{$lineId}','{$orderId}','6000000','123','COUPON','0.0001')";
	//数据查询
    $result=odbc_prepare($sqlconnection,$saveSql);  
    if(!odbc_execute($result)){
        exit('发货失败');
    }
    exit('发货成功');
	odbc_close($sqlconnection);
	
	
	
